Skip to content

Conversation

@trancexpress
Copy link
Contributor

@trancexpress trancexpress commented Nov 5, 2025

This pull request introduces support for custom OSGi ResolverHooks in the PDE launch and validation workflow, specifically enabling exclusion of JUnit 6 bundles when running JUnit 5 tests. The changes add a mechanism to inject a ResolverHook into the bundle validation process and implement a hook that filters out JUnit 6 bundles, improving compatibility and reliability of JUnit 5 plug-in test launches.

@trancexpress
Copy link
Contributor Author

@laeubi do you mean something like this? Coming from your comment here: #2092 (comment)

Or we report errors in some way instead of removing the candidate?

We do enter the new code with this in the MANIFEST.MF:

 org.junit,
 junit-jupiter-api

But removing the JUnit 6 bundle doesn't seem to fix the launch. There is no error dialog but still no tests are executed.

@github-actions
Copy link

github-actions bot commented Nov 5, 2025

Test Results

36 files   -    735  36 suites   - 735   19s ⏱️ - 50m 42s
48 tests  -  3 586  48 ✅  -  3 532  0 💤  -  54  0 ❌ ±0 
78 runs   - 10 758  78 ✅  - 10 595  0 💤  - 163  0 ❌ ±0 

Results for commit 5544b96. ± Comparison against base commit 5878cb4.

This pull request removes 3586 tests.
AllPDETests AllBundleModelTests BundleActivatorTestCase ‑ testAbsentHeader
AllPDETests AllBundleModelTests BundleActivatorTestCase ‑ testChangeExistingActivator
AllPDETests AllBundleModelTests BundleActivatorTestCase ‑ testGetActivator
AllPDETests AllBundleModelTests BundleActivatorTestCase ‑ testHeaderLength
AllPDETests AllBundleModelTests BundleActivatorTestCase ‑ testHeaderLengthWithWindowsDelimiter
AllPDETests AllBundleModelTests BundleActivatorTestCase ‑ testHeaderOffset1
AllPDETests AllBundleModelTests BundleActivatorTestCase ‑ testHeaderOffset2
AllPDETests AllBundleModelTests BundleActivatorTestCase ‑ testPresentHeader
AllPDETests AllBundleModelTests BundleActivatorTestCase ‑ testSetActivator
AllPDETests AllBundleModelTests BundleClasspathTestCase ‑ testAbsentHeader
…

♻️ This comment has been updated with latest results.

@trancexpress trancexpress force-pushed the gh2045_test branch 3 times, most recently from 2ad2daa to 84cefb2 Compare November 6, 2025 07:22
@trancexpress
Copy link
Contributor Author

If I don't skip junit bundles in the outer loop, the validation does detect the case where junit-jupiter-api is unrestricted in the MANIFEST.MF. But org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRendererTest fails to run and org.apache.ant is not mentioned in the list of bundles of the validation dialog...

@trancexpress trancexpress force-pushed the gh2045_test branch 2 times, most recently from b5694f1 to a675712 Compare November 6, 2025 12:07
@trancexpress trancexpress force-pushed the gh2045_test branch 2 times, most recently from b19fd69 to 4be4962 Compare November 6, 2025 13:33
@trancexpress trancexpress changed the title Gh2045 test Validate that a JUnit 5 launch has no dependencies to JUnit 6 bundles Nov 6, 2025
@trancexpress trancexpress force-pushed the gh2045_test branch 3 times, most recently from 6638c00 to ce96f32 Compare November 6, 2025 14:00
@trancexpress
Copy link
Contributor Author

With MANIFEST.MF:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: TestPlugin3
Bundle-SymbolicName: TestPlugin3
Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.eclipse.swt,
 org.eclipse.jface,
 org.junit,
 junit-jupiter-api
Automatic-Module-Name: TestPlugin3
Bundle-RequiredExecutionEnvironment: JavaSE-21

The dialog is:

Screenshot_20251106_160440

With removing the optional resolution check and running ToolBarManagerRendererTest:

Screenshot_20251106_154234

@laeubi WDYT?

@laeubi
Copy link
Contributor

laeubi commented Nov 6, 2025

The text might be a bit improved but that's something that can be done later, beside that it looks good and will allow the user to identify the issue.

What do you think about

"JUnit "+majorversionofjunitbundle+" is incompatible with selected JUnit "+versionweactuallywant+" runtime selected for the launch"

I think we should just state this as is and not add "may" .. from the second picture we maybe like to record the offending resource only once, I assume the same bundle has two requirements that can cause problems.

@trancexpress
Copy link
Contributor Author

trancexpress commented Nov 6, 2025

from the second picture we maybe like to record the offending resource only once, I assume the same bundle has two requirements that can cause problems.

IMO best to list all involved bundles. There are actually several requirements, likely package imports:

Screenshot_20251106_150809

This is why I check in the code that we don't show the same message multiple times.

@trancexpress trancexpress marked this pull request as ready for review November 6, 2025 14:44
This change introduces support for custom OSGi ResolverHooks in the PDE launch and validation workflow,
specifically enabling exclusion of JUnit 6 bundles when running JUnit 5 tests.
The changes add a mechanism to inject a ResolverHook into the bundle validation process
and implement a hook that filters out JUnit 6 bundles,
improving compatibility and reliability of JUnit 5 plug-in test launches.

Fixes: eclipse-pde#2045
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants